﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using Aplicacao;
using System.Data;

public partial class verificar_cadastro : System.Web.UI.Page
{
    private string cpf {
        get {
            if (String.IsNullOrEmpty(Request.QueryString["cpf"]))
                return string.Empty;
            else
                return Request.QueryString["cpf"];
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) {
            if (!String.IsNullOrEmpty(cpf))
            {
                BancoDeDados bd = new BancoDeDados();
                SqlConnection conection = bd.iniciaConexao();
                Usuario user = new Usuario();
                if (user.VerificaUsuarioCadastrado(cpf, conection) != null)
                {
                    DataSet ds = new DataSet("InfoUsuario");
                    DataTable dt = new DataTable();
                    dt = user.VerificaUsuarioCadastrado(cpf, conection);
                    ds.Tables.Add(dt);
                    Page.Response.ContentType = "text/xml";
                    Page.Response.Charset = "utf-8";
                    Page.Response.Write(ds.GetXml());
                }
            }
            else {
                Page.Response.Write(string.Empty);
            }
        }
    }
}